﻿@model Model.AppUserList
@{
    ViewBag.Title = "InitStock";
    Layout = "~/Views/Shared/_JQBaseLayOut.cshtml";
}
@using Model

@section JQscriptSection{
    <script type="text/javascript">
        $(document).ready(function () {
            InitGrid();

        });

        HandleDom.ClassTriggerClick("icon-exporter", function () {
            var form = $('#query');
            var rows = $(".pagination-page-list option:selected").text();
            var page = $("input[size='2']").val();
            form.form('submit', {
                url: '@Url.Content("~/InitStock/ExportExcel")' + '?page=' + page + '&rows=' + rows,
                success: function (data) {
                    eval('data=' + data);
                    if (data.success) {
                        layer.alert('执行成功!', 9);
                    } else {
                        layer.msg(data.msg, 1);
                    }
                }
            });

        });
        function InitGrid() {
            var txtGOODSBATCHCODE = $('#txtGOODSBATCHCODE').val();
            var txtGOODSCODE = $('#txtGOODSCODE').val();

            queryParams = {
                goodsBatchCode: txtGOODSBATCHCODE,
                goodsCode: txtGOODSCODE
            }
            HandleData.InitDataGrid('dg', '/InitStock/InitJsonResult', 'toolbar', queryParams, 'LOCATIONINVENTORYID', true, function (data) { },
                function (rowIndex, rowData) {//双击
                    edit(rowData);
                });
        }

        function InitOnlineStock() {
            layer.confirm('是否确认同步？', function (){
                var form = $('#query');
                var rows = $(".pagination-page-list option:selected").text();
                var page = $("input[size='2']").val();
                form.form('submit', {
                    url: '@Url.Content("~/InitStock/InitOnlineStock")' + '?page=' + page + '&rows=' + rows,
                    success: function (data) {
                        eval('data=' + data);
                        if (!data.hasError) {
                            layer.alert('执行成功!', 9);
                        } else {
                            layer.msg(data.error, 2);
                        }
                    }
                });
            });
        } 

    </script>
}

<body style="background-color: ButtonFace; font-size: 17px">
    <div class="easyui-panel" title="查询条件" style="height: 100px; padding: 5px; background: #fafafa; width: 1700px;">
        <form id="query" method="post">
            <table>
                <tr>
                    <td>
                        原料商品编码:
                    </td>
                    <td>
                        <input id="txtGOODSBATCHCODE" name="txtGOODSBATCHCODE" style="width: 154px" />
                    </td> 
                    <td>
                        成品编码:
                    </td>
                    <td>
                        <input id="txtGOODSCODE" name="txtGOODSCODE" style="width: 154px" />
                    </td> 
                    <td>
                        <a id="btnSerach" href="#" class="easyui-linkbutton" data-options="iconCls:'icon-search'" onclick="InitGrid()">查询</a>
                    </td> 
                    <td><p style="width:200px"></td>
                    <td>
                        <a id="InitData" href="#" class="easyui-linkbutton" onclick="InitOnlineStock()">同步在线库存</a>
                    </td>
                </tr>
                 
            </table>
        </form>

    </div>
    <div style="min-height: 720px; width: 1700px;">
        <table id="dg" title="货位信息" style="min-height: 600px;">
            <thead>
                <tr>
                    @*<th data-options="field:'LOCATIONINVENTORYID',width:30">货位库存ID</th>*@
                    <th data-options="field:'batch_no',width:50">商品批次号</th>
                    @*<th data-options="field:'LOCATIONCODE',width:50">货位编码</th>*@
                    <th data-options="field:'goods_sn',width:50">商品编码</th>
                    @*<th data-options="field:'GOODSNAME',width:50">商品名称</th>*@
                    @*<th data-options="field:'WAREHOUSENAME',width:50">仓库</th>
                    <th data-options="field:'CELLNO',width:30">库位</th>*@
                    @*<th data-options="field:'PRODUCTIONDATE',width:30">生产日期</th>*@
                    <th data-options="field:'real_stock',width:30">库存数</th>
                    <th data-options="field:'expiry_date',width:30">截止有效日期</th>
                    @*<th data-options="field:'UNITNAME',width:30">单位</th>*@
                    @*<th data-options="field:'PURQTY',width:50, align: 'center', sortable: true, formatter:function(value, rowData, rowIndex){ return FormatData.formatvalidSumQty(rowData);}">采购单位库存</th>*@
                    @*<th data-options="field:'STORAGEDATE',width:100, align: 'center', sortable: true, formatter:function(value, rowData, rowIndex){ return FormatData.formatvalidDay(rowData);}">有效天数</th>
                    <th data-options="field:'PURUNITQTY',width:100">换算系数</th>*@

                    <th data-options="field:'stock_memo',width:30">备注</th>
                    <th data-options="field:'stock_date',width:30">库存日</th>
                    <th data-options="field:'stock_datebegin',width:30">库存日开始日期</th>
                    <th data-options="field:'stock_dateend',width:30">库存日结束日期</th>
                </tr>
            </thead>
        </table>
    </div>
    @Html.Partial("~/Views/Shared/_PartialToolbar.cshtml", new Toolbar
{
    GridName = "dg",
    GridType = "datagrid",
    ToolbarName = "toolbar",
    FunctionModule = new Dictionary<string, List<FunctionModule>>()
    {
        {"Function",new List<FunctionModule>()
            {
              new FunctionModule(){Name = "Add",IsEnable =false },
              new FunctionModule(){Name = "Edit",IsEnable =false },
              new FunctionModule(){Name = "Remove",IsEnable =false },
              new FunctionModule(){Name = "Reload",IsEnable =false },
              new FunctionModule(){Name = "Collapse",IsEnable =false },
              new FunctionModule(){Name = "Exporter",IsEnable =false },

            }
        }
    }
})

</body>


